<?php
/**
 * Created by PhpStorm.
 * User: mars
 * Date: 2018/6/22
 * Time: 下午8:57
 */

namespace common\models;


class Fellow extends \backend\models\Fellow {

	public function findFellowByUId($uid){
		return self::findBySql('SELECT f_uid FROM fellow WHERE uid = '.$uid)->all();
	}

	public function findMyFellowByUid($uid){
		return self::findAll(['f_uid'=>$uid]);
	}

	public function findFellow($uid){
		return self::findAll(['uid'=>$uid]);
	}

	public static function isFellow($uid,$f_uid){
		if (self::findOne(['uid'=>$uid,'f_uid'=>$f_uid])){
			return true;
		}
		return false;
	}


	/**
	 * Returns static class instance, which can be used to obtain meta information.
	 *
	 * @param bool $refresh whether to re-create static instance even, if it is already cached.
	 *
	 * @return static class instance.
	 */
	public static function instance( $refresh = false ) {
		// TODO: Implement instance() method.
}}